//
//  UIView+Extension.swift
//  weiboXue
//
//  Created by xue-iOS-work on 16/8/29.
//  Copyright © 2016年 iOS-work. All rights reserved.
//

import UIKit
// 定义一个圆角
extension UIView{
  @IBInspectable  var cornerRadius:CGFloat{
        set{
            layer.cornerRadius = newValue
            layer.masksToBounds = newValue > 0
        }
        get{
            return layer.cornerRadius
        }
    }
    
}
// 定义一个label对应的属性
extension UILabel{
    convenience init(labelColor:UIColor,fontSize:CGFloat) {
        self.init()
        self.textColor = labelColor
        self.font = UIFont.systemFont(ofSize: fontSize)
    }
}
// 定义一个按钮对应的属性
extension UIButton{
    convenience init(textNormalColor:UIColor?=nil,textHighlightedColor:UIColor?=nil,fontsize:CGFloat,titleName:String?=nil){
        self.init()
        self.setTitle(titleName, for: .normal)
        self.titleLabel?.font = UIFont.systemFont(ofSize:fontsize)
        self.setTitleColor(textNormalColor, for: .normal)
        self.setTitleColor(textHighlightedColor, for:.highlighted)
        
        
    }
}
